package com.lyf.viewapp.animations;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;

import com.lyf.viewapp.base.BaseActivity;
import com.lyf.viewapp.R;
import com.lyf.viewapp.animations.circlemenu.CircleMenuActivity;
import com.lyf.viewapp.animations.contextmenu.ContextMenuActivity;
import com.lyf.viewapp.animations.one.AndroidViewAnimationsActivity;
import com.lyf.viewapp.util.EnterAdapter;
import com.lyf.viewapp.util.EnterBean;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 动画主界面
 *
 * @author lyf
 */
public class AnimationsMainActivity extends BaseActivity {

    @BindView(R.id.animations_listView)
    ListView animationsListView;

    private List<EnterBean> list;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_animations_main);
        ButterKnife.bind(this);
        list = new ArrayList<>();
        initView();
    }

    private void initView() {
        list.add(new EnterBean("AndroidViewAnimations", AndroidViewAnimationsActivity.class));
        list.add(new EnterBean("Context-Menu", ContextMenuActivity.class));
        list.add(new EnterBean("CircleMenu", CircleMenuActivity.class));

        EnterAdapter ada = new EnterAdapter(this, list);
        animationsListView.setAdapter(ada);
        animationsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Intent intent = new Intent(AnimationsMainActivity.this, list.get(position).getActivity());
                startActivity(intent);
            }
        });
    }
}
